package classdemo;

public class Dad {                                  //创建父类
    public String name;

    public Dad(String name) {
        this.name = name;
        System.out.println("Dad:构造方法执行！");
    }
    {
        System.out.println("Dad:实例代码块执行!");
    }
    static {
        System.out.println("Dad:静态化代码块执行！");
    }
}

class Son extends Dad{                              //子类继承

    public Son(String name) {
        super(name);
        System.out.println("Son:构造方法执行！");

    }
    {
        System.out.println("Son:实例代码块执行!");
    }
    static{
        System.out.println("Son:静态化代码块执行！");
    }
}

